package de.baumann.browser.rx;

import java.util.concurrent.TimeUnit;

import de.baumann.browser.api.net.base.RetryWithDelay;
import de.baumann.browser.iview.IBaseView;
import io.reactivex.ObservableTransformer;
import io.reactivex.SingleTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Action;
import io.reactivex.schedulers.Schedulers;

public class RxSchedulers {

    public static <T> ObservableTransformer<T, T> ioMain() {
        return upstream -> upstream
                .throttleFirst(3, TimeUnit.SECONDS)
//                .retryWhen(new RetryWithDelay(3, 4000))
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}
